<!DOCTYPE html>
<html   xmlns="http://www.w3c.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:p="http://primefaces.org/ui"
        xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <script type="text/javascript">
            function start() {
                PF('statusDialog').show();
            }

            function stop() {
                PF('statusDialog').hide();
            }
        </script>
    </h:head>
    <h:body>
        <h:form>
            <h:commandButton value="Download">
                <p:fileDownload value="#{fileDownloadBean.file}"/>
            </h:commandButton>
        </h:form>
        
        
        
        
        <p:dialog modal="true" widgetVar="statusDialog" header="Status" draggable="false" closable="false" resizable="false">
            <p:graphicImage name="/IMG/icon4.png" />
        </p:dialog>

        <h:form>
            <p:commandButton value="Download" ajax="false" onclick="PrimeFaces.monitorDownload(start, stop);" icon="ui-icon-arrowthick-1-s">
                <p:fileDownload value="#{fileDownloadBean.file}" />
            </p:commandButton>
        </h:form>
        
        
        
        <h:form>
            <p:dialog modal="true" widgetVar="statusDialog" header="Status" draggable="false" closable="false">
                <p:graphicImage value="/IMG/ajaxloading.gif" />
            </p:dialog>
            <p:commandButton value="Download" ajax="false" onclick="PrimeFaces.monitorDownload(showStatus, hideStatus)">
                <p:fileDownload value="#{fileDownloadBean.file}"/>
            </p:commandButton>
        </h:form>
    </h:body>
</html>
